<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

</body>
<script>
    var cars = [
        {type:"Volvo", year:2016},
        {type:"Saab", year:2001},
        {type:"BMW", year:2010}];
    console.log(cars.sort(function (a,b) {
        return a.type < b.type ? -1 : 1
    }))
    // console.log(arr.sort())
</script>
</html>